package com.yy.jhl.ui.manager.presenter;

import com.google.gson.Gson;
import com.yy.jhl.api.Api;
import com.yy.jhl.api.RxSubscriber;
import com.yy.jhl.app.AppConstant;
import com.yy.jhl.bean.BatchListInfo;
import com.yy.jhl.bean.CGSOrderInfoList;
import com.yy.jhl.ui.manager.contract.BatchManagerContract;
import com.yy.jhl.ui.manager.contract.MenuTwoJGContract;

import java.util.HashMap;
import java.util.Map;

import okhttp3.ResponseBody;

/**
 * Created by libingn on 2017/12/14.
 */

public class BatchManagerPresenter extends BatchManagerContract.Presenter {
    @Override
    public void getList(String order_id,int page,boolean isDialog) {
        Map<String,Object> requestMap = new HashMap<>();
        requestMap.put("order_id",order_id);
        requestMap.put("page_size",AppConstant.PAGE_SIZE);
        requestMap.put("page",page );
        mRxManage.addSubscription(Api.getDefault().cgsGetJGBatchList(requestMap), new RxSubscriber<ResponseBody>(mContext,isDialog) {
            @Override
            protected void _onNext(String result) {
                BatchListInfo info = new Gson().fromJson(result,BatchListInfo.class);
                mView.getListSuccess(info.getData());
            }

            @Override
            protected void _onError(String message) {
                mView.getListFail();
            }
        });
    }
}
